/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaActualizarBebe.java
 *
 * Created on 20/01/2012, 02:01:16 PM
 */
package vista;

import controlador.ControladorGeneral;
import controlador.ControladorVentana;

/**
 *
 * @author Jesús Vásquez
 */
public class VentanaActualizarBebe extends javax.swing.JFrame {

    ControladorVentana controladorVentana;
    ControladorGeneral controlador;
    
    /** Creates new form VentanaActualizarBebe */
    public VentanaActualizarBebe() {
        initComponents();
        controladorVentana = new ControladorVentana();
        controlador = new ControladorGeneral();
        
        controlador.listarBebes();
        controladorVentana.llenarListaBebe(comboBebe, controlador.getListaBebe());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        comboBebe = new javax.swing.JComboBox();
        botonActualizar = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        textoEdad = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        textoPeso = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        textoCircunferencia = new javax.swing.JTextField();
        botonConsultar = new javax.swing.JButton();
        botonRegresar = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        textoEstatura = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        comboBebe.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboBebe.setBounds(230, 100, 200, 30);
        jLayeredPane1.add(comboBebe, javax.swing.JLayeredPane.DEFAULT_LAYER);

        botonActualizar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        botonActualizar.setText("Actualizar");
        botonActualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonActualizarActionPerformed(evt);
            }
        });
        botonActualizar.setBounds(480, 320, 100, 30);
        jLayeredPane1.add(botonActualizar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Consultorio - Actualizar datos bebé");
        jLabel2.setBounds(0, 30, 600, 50);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        textoEdad.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textoEdad.setText("...");
        textoEdad.setBounds(230, 160, 200, 21);
        jLayeredPane1.add(textoEdad, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel3.setText("Seleccionar bebé:");
        jLabel3.setBounds(40, 110, 130, 20);
        jLayeredPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Peso (kg):");
        jLabel4.setBounds(40, 240, 110, 20);
        jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        textoPeso.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textoPeso.setText("...");
        textoPeso.setBounds(230, 240, 200, 21);
        jLayeredPane1.add(textoPeso, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Circunferencia encefáilca (cm):");
        jLabel5.setBounds(40, 280, 190, 20);
        jLayeredPane1.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        textoCircunferencia.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textoCircunferencia.setText("...");
        textoCircunferencia.setBounds(230, 280, 200, 21);
        jLayeredPane1.add(textoCircunferencia, javax.swing.JLayeredPane.DEFAULT_LAYER);

        botonConsultar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        botonConsultar.setText("Consultar");
        botonConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonConsultarActionPerformed(evt);
            }
        });
        botonConsultar.setBounds(460, 100, 100, 30);
        jLayeredPane1.add(botonConsultar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        botonRegresar.setFont(new java.awt.Font("Tahoma", 0, 14));
        botonRegresar.setText("Cancelar");
        botonRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegresarActionPerformed(evt);
            }
        });
        botonRegresar.setBounds(480, 360, 100, 30);
        jLayeredPane1.add(botonRegresar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel6.setText("Edad:");
        jLabel6.setBounds(40, 160, 110, 20);
        jLayeredPane1.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("Estatura (cm):");
        jLabel7.setBounds(40, 200, 110, 20);
        jLayeredPane1.add(jLabel7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        textoEstatura.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textoEstatura.setText("...");
        textoEstatura.setBounds(230, 200, 200, 21);
        jLayeredPane1.add(textoEstatura, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botonRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegresarActionPerformed
        controladorVentana.ventanaPrincipal(this);
    }//GEN-LAST:event_botonRegresarActionPerformed

    private void botonConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonConsultarActionPerformed
        controladorVentana.llenarCamposActualizacion(comboBebe, textoEstatura, textoPeso, textoCircunferencia, textoEdad, controlador.getListaBebe());
    }//GEN-LAST:event_botonConsultarActionPerformed

    private void botonActualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonActualizarActionPerformed
        controlador.actualizarBebe(comboBebe, textoEstatura, textoPeso, textoCircunferencia, textoEdad, controlador.getListaBebe());
    }//GEN-LAST:event_botonActualizarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonActualizar;
    private javax.swing.JButton botonConsultar;
    private javax.swing.JButton botonRegresar;
    private javax.swing.JComboBox comboBebe;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JTextField textoCircunferencia;
    private javax.swing.JTextField textoEdad;
    private javax.swing.JTextField textoEstatura;
    private javax.swing.JTextField textoPeso;
    // End of variables declaration//GEN-END:variables
}
